FROM nvidia/cuda:10.0-cudnn7-runtime-ubuntu18.04

ENV LANG C.UTF-8

WORKDIR /project/face-web

RUN apt-get update && \
    apt-get install -y cmake python3 python3-pip libsm6 libxrender1 libxext-dev


RUN python3 -m pip --no-cache-dir install --upgrade \
    pip \
    setuptools


RUN ln -s $(which python3) /usr/local/bin/python

COPY requirements-gpu.txt ./
RUN pip install -r requirements-gpu.txt --use-feature=2020-resolver -i https://mirrors.aliyun.com/pypi/simple/

COPY . .

RUN cd /project/face-web/model/RetinaFace && make

ENV WORKERS_NUM="2"

ENTRYPOINT cd /project/face-web && uvicorn api_oa_face_fastapi_v2:app --host 0.0.0.0 --port 17104 --workers ${WORKERS_NUM}

